package cn.yh.kettle_service.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: wenjian
 * @Time: 2025-04-15 16:53
 * @Version: 1.0 计算程序运行的时间
 */
@Slf4j
public class RunDateUtils {


    public static String getRunDate(long startTime, long endTime, String logMessage) {

        long durationInMillis = endTime - startTime;
        // 计算时间花费
        long hours = (durationInMillis % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000);
        long minutes = (durationInMillis % (60 * 60 * 1000)) / (60 * 1000);
        long seconds = (durationInMillis % (60 * 1000)) / 1000;
        log.error(logMessage + "耗时：" + hours + "小时" + minutes + "分" + seconds + "秒");
        return "耗时：" + seconds + "秒";
    }


}
